package com.sh.二叉树;

/**
 * @Auther: sh
 * @Version 1.0
 * @Description:
 */
public class 二叉树的最大深度 {
    public static void main(String[] args) {

    }

    public int maxDepth(TreeNode root) {
        int fun = fun(root);
        return fun;
    }

    public int fun(TreeNode node ){
        if (node==null){
            return 0;
        }
        int left = fun(node.left);
        int right = fun(node.right);
        int mode = Math.max(left, right)+1;
        return mode;
    }

}

